﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;

//using Microsoft.VisualStudio.TestTools.UnitTesting;

//using Pibby.Core.IO;
//using Pibby.Core.Models;
//using Pibby.Core.Persistence;

//namespace Pibby.Core.Tests
//{
//    [TestClass]
//    public class EpisodeModelTests : IntegrationBaseTestFixture
//    {
//        const int podcastCount = 10;
//        const int episodeCount = 5;

//        IFolder _downloadFolder;
 
//        [TestInitialize]
//        public override void Setup()
//        {
//            base.Setup();

//            string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
//            this._downloadFolder = new Stubs.Folder(folderPath, 25, 0);

//            foreach (Podcast p in Stubs.PodcastFactory.GeneratePodcasts("mypodcast", podcastCount))
//            {
//                this.Repository.Put(p);

//                foreach (var ep in Stubs.EpisodeFactory.GenerateEpisodes(p.SafeName, episodeCount, EpisodeAge.BrandNew, EpisodeLifecycle.NotDownloaded))
//                {
//                    this.Repository.Put(ep);
//                }
//            }
//        }

//        [TestMethod]
//        public void Model_DownloadFolder_IsNotNull()
//        {
//            EpisodeModel m = new EpisodeModel(this.Repository, this._downloadFolder);
//            m.Populate();

//            Assert.AreEqual(this._downloadFolder, m.DownloadFolder);
//        }

//        [TestMethod]
//        public void Model_AllPodcasts_ContainsCorrectEpisodes()
//        {
//            EpisodeModel m = new EpisodeModel(this.Repository, this._downloadFolder);
//            m.Populate();

//            Assert.AreEqual(podcastCount * episodeCount, m.Episodes.Count);
//        }

//        [TestMethod]
//        public void Model_AllPodcasts_SelectionContainsNoEpisodes()
//        {
//            EpisodeModel m = new EpisodeModel(this.Repository, this._downloadFolder);
//            m.Populate();

//            Assert.AreEqual(0, m.SelectedEpisodes.Count);
//        }

//        [TestMethod]
//        public void Model_AllPodcasts_SelectAllContainsAllEpisodes()
//        {
//            EpisodeModel m = new EpisodeModel(this.Repository, this._downloadFolder);
//            m.Populate();

//            Assert.AreEqual(0, m.SelectedEpisodes.Count);

//            m.SelectAll();
//            Assert.AreEqual(podcastCount * episodeCount, m.Episodes.Count);
//        }

//        [TestMethod]
//        public void Model_AllPodcasts_ClearAllClearsEpisodes()
//        {
//            EpisodeModel m = new EpisodeModel(this.Repository, this._downloadFolder);
//            m.Populate();

//            Assert.AreEqual(0, m.SelectedEpisodes.Count);

//            m.SelectAll();
//            Assert.AreEqual(podcastCount * episodeCount, m.Episodes.Count);

//            m.ClearAll();
//            Assert.AreEqual(0, m.SelectedEpisodes.Count);
//        }

//        [TestMethod]
//        public void Model_AllPodcasts_DownloadsAreEmpty()
//        {
//            EpisodeModel m = new EpisodeModel(this.Repository, this._downloadFolder);
//            m.Populate();

//            Assert.AreEqual(0, m.EpisodesSelectedForDownload.Count);
//        }

//        [TestMethod]
//        public void Model_SinglePodcast_ContainsEpisodes()
//        {
//            PodcastCollection all = this.Repository.GetAllPodcasts ();
//            Assert.AreEqual(podcastCount, all.Count);

//            EpisodeModel m = new EpisodeModel(this.Repository, this._downloadFolder, all[0]);
//            m.Populate();

//            Assert.AreEqual(episodeCount, m.Episodes.Count);

//            EpisodeModel m2 = new EpisodeModel(this.Repository, this._downloadFolder, all[1].Id);
//            m2.Populate();

//            Assert.AreEqual(episodeCount, m2.Episodes.Count);
//        }

//    }
//}
